package cn.spiral.qz_job.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import cn.spiral.core.dao.impl.BaseDaoImpl;
import cn.spiral.qz_job.dao.QzJobDao;
import cn.spiral.qz_job.entity.QzJob;

@Repository("qzJobDao")
public class QzJobDaoImpl extends BaseDaoImpl<QzJob> implements QzJobDao{
	
	public QzJob findJobByName(String jobName){
		String hql="FROM QzJob WHERE jobName = ?";
		Query query = this.getSession().createQuery(hql);
		query.setParameter(0, jobName);
		List list=query.list();
		return (list.size()>0?(QzJob)list.get(0):null);
	}

	public List<QzJob> findUndoJob(){
		
		String hql="FROM QzJob WHERE jobState<3";
		Query query=this.getSession().createQuery(hql);
		return query.list();
	}
}
